package com.csw.jdbc.service.impl;
 
import com.csw.jdbc.dao.TbUserDao;
import com.csw.jdbc.entity.TbPermission;
import com.csw.jdbc.dao.TbPermissionDao;
import com.csw.jdbc.service.TbPermissionService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
 
 
 /**
 * 权限表(TbPermission)表服务实现类
 * @author chengshengwen
 * @description 
 * @since 2021-11-01 00:20:09
 */
@Service
@Transactional
@AllArgsConstructor
public class TbPermissionServiceImpl implements TbPermissionService {

    private final TbPermissionDao tbPermissionDao;

    /**
     * 通过ID查询单条数据
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public TbPermission queryById(Long id) {
        return tbPermissionDao.queryById(id);
    }
 
    /**
     * 查询多条数据
     * @param tbPermission 实例对象
     * @return 对象列表
     */
    @Override
    public List<TbPermission> queryAll(TbPermission tbPermission) {
        //PageHelper.startPage(pageNum,pageSize);
        List<TbPermission> dataList = tbPermissionDao.queryAll(tbPermission);
        //PageInfo<TbPermission> page = new PageInfo<TbPermission>(dataList);
        return dataList;
    }
 
    /**
     * 新增数据
     * @param tbPermission 实例对象
     * @return 实例对象
     */
    @Override
    public int insert(TbPermission tbPermission) {
        return tbPermissionDao.insert(tbPermission);
    }
 
    /**
     * 修改数据
     * @param tbPermission 实例对象
     * @return 实例对象
     */
    @Override
    public int updateById(TbPermission tbPermission) {
        return tbPermissionDao.updateById(tbPermission);
    }
 
    /**
     * 通过主键id删除数据
     * @param id 主键
     */
    @Override
    public int deleteById(Long id) {
        return tbPermissionDao.deleteById(id);
    }

     @Override
     public List<TbPermission> selectByUserId(Long userId) {
         return tbPermissionDao.selectByUserId(userId);
     }


 }